﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;
using MyCommon;

namespace BussinessLayer
{
    public class NghiepVuBO : BaseBO
    {
        public IEnumerable<View_ThietBiBHDetail> GetDsThietBiBHSC()
        {
            return _dao.NghiepVu.GetDsThietBiDoiBHSC();
        }

        public IEnumerable<View_ThietBiBHDetail> GetDsThietBiBHSCByNhanVienId(int inNhanVienId)
        {
            return _dao.NghiepVu.GetDsThietBiBHSCByNhanVienId(inNhanVienId);
        }


        public IEnumerable<View_ThietBiBHDetail> GetDsThietBiBHSCByNhanVienIdInDay(int inNhanVienId, int inTrangThaiBHId, DateTime inDay)
        {
            return _dao.NghiepVu.GetDsThietBiBHSCByNhanVienId(inDay, inDay, inNhanVienId, inTrangThaiBHId);
        }

        public IEnumerable<View_ThietBiBHDetail> GetDsThietBiBHSCByNhanVienIdInMonth(int inNhanVienId, int inTrangThaiBHId, DateTime inMonth)
        {
            DateTime FristDate = new DateTime(inMonth.Year, inMonth.Month, 1);
            DateTime LastDate = FristDate.AddMonths(1).AddDays(-1);
            return _dao.NghiepVu.GetDsThietBiBHSCByNhanVienId(FristDate, LastDate, inNhanVienId, inTrangThaiBHId);
        }

        public IEnumerable<View_ThietBiBHDetail> GetDsThietBiBHSCByNhanVienIdBetween(int inNhanVienId, int inTrangThaiBHId, DateTime inFromDate, DateTime inToDate)
        {
            return _dao.NghiepVu.GetDsThietBiBHSCByNhanVienId(inFromDate, inToDate, inNhanVienId, inTrangThaiBHId);
        }

        public IEnumerable<View_ThietBiBHDetail> GetDsThietBiBHSCCuaNVInDay(int inNhanVienId, DateTime inDay, List<int> inTrangThaiTBBHList)
        {
            return _dao.NghiepVu.GetDsThietBiBHSCCuaNVTheoNgayThucHien(inDay, inDay, inNhanVienId, inTrangThaiTBBHList);
        }

        public IEnumerable<View_ThietBiBHDetail> GetDsThietBiBHSCCuaNVInMonth(int inNhanVienId, DateTime inMonth, List<int> inTrangThaiTBBHList)
        {
            DateTime FristDate = new DateTime(inMonth.Year, inMonth.Month, 1);
            DateTime LastDate = FristDate.AddMonths(1).AddDays(-1);
            return _dao.NghiepVu.GetDsThietBiBHSCCuaNVTheoNgayThucHien(FristDate, LastDate, inNhanVienId, inTrangThaiTBBHList);
        }

        public IEnumerable<View_ThietBiBHDetail> GetDsThietBiBHSCCuaNVBetween(int inNhanVienId, DateTime inFromDate, DateTime inToDate, List<int> inTrangThaiTBBHList)
        {
            return _dao.NghiepVu.GetDsThietBiBHSCCuaNVTheoNgayThucHien(inFromDate, inToDate, inNhanVienId, inTrangThaiTBBHList);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThai(List<int> inListTrangThaiTBId)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThai(inListTrangThaiTBId);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThai(List<int> inListTrangThaiTBId, DateTime inTraFromDate, DateTime inTraToDate)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThai(inListTrangThaiTBId, inTraFromDate, inTraToDate);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThaiLocMaPhien(List<int> inListTrangThaiTBId, string inMaPhien)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThaiLocMaPhien(inListTrangThaiTBId, inMaPhien);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThaiLocMaThietBi(List<int> inListTrangThaiTBId, string inMaThietBi)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThaiLocMaThietBi(inListTrangThaiTBId, inMaThietBi);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThaiLocTenKhachHang(List<int> inListTrangThaiTBId, string inTenKhachHang)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThaiLocTenKhachHang(inListTrangThaiTBId, inTenKhachHang);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThaiLocMaPhien(List<int> inListTrangThaiTBId, string inMaPhien, DateTime inTraFromDate, DateTime inTraToDate)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThaiLocMaPhien(inListTrangThaiTBId, inMaPhien, inTraFromDate, inTraToDate);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThaiLocMaThietBi(List<int> inListTrangThaiTBId, string inMaThietBi, DateTime inTraFromDate, DateTime inTraToDate)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThaiLocMaThietBi(inListTrangThaiTBId, inMaThietBi, inTraFromDate, inTraToDate);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThaiLocTenKhachHang(List<int> inListTrangThaiTBId, string inTenKhachHang, DateTime inTraFromDate, DateTime inTraToDate)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThaiLocTenKhachHang(inListTrangThaiTBId, inTenKhachHang, inTraFromDate, inTraToDate);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThaiLocTenThietBi(List<int> inListTrangThaiTBId, string inMaThietBi)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThaiLocTenThietBi(inListTrangThaiTBId, inMaThietBi);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsThietBiInListTrangThaiLocTenThietBi(List<int> inListTrangThaiTBId, string inTenThietBi, DateTime inTraFromDate, DateTime inTraToDate)
        {
            return _dao.NghiepVu.GetDsThietBiInListTrangThaiLocTenThietBi(inListTrangThaiTBId, inTenThietBi, inTraFromDate, inTraToDate);
        }

        public IEnumerable<View_PhieuTiepNhan> GetReportPhieuTiepNhanById(int inPhieuId)
        {
            return _dao.NghiepVu.GetReportPhieuTiepNhanById(inPhieuId);
        }
        
        public IEnumerable<View_ThietBiBHDetail> GetDsTbiDangONCCById(int NhaCungCapId = 0)
        {
            return _dao.NghiepVu.GetDsTbiDangONCCById(NhaCungCapId);
        }

        public IEnumerable<View_PhienBHSCNgay> GetDsPhienBHSCNgayInDay(DateTime inDay)
        {
            return _dao.NghiepVu.GetDsPhienBHSCNgay(inDay, inDay);
        }

        public IEnumerable<View_PhienBHSCNgay> GetDsPhienBHSCNgayInMonth(DateTime inMonth)
        {
            DateTime FristDate = new DateTime(inMonth.Year, inMonth.Month, 1);
            DateTime LastDate = FristDate.AddMonths(1).AddDays(-1);
            return _dao.NghiepVu.GetDsPhienBHSCNgay(FristDate, LastDate);
        }

        public IEnumerable<View_PhienBHSCNgay> GetDsPhienBHSCNgayBetween(DateTime inNhanFromDate, DateTime inNhanToDate)
        {
            return _dao.NghiepVu.GetDsPhienBHSCNgay(inNhanFromDate, inNhanToDate);
        }

        //////////////////////////////
        public IEnumerable<View_TheoDoiTraHang> GetDsPhienTiepNhanBHSCInDay(DateTime inDay)
        {
            return _dao.NghiepVu.GetDsPhienTiepNhanBHSC(inDay, inDay);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsPhienTiepNhanBHSCInMonth(DateTime inMonth)
        {
            DateTime FristDate = new DateTime(inMonth.Year, inMonth.Month, 1);
            DateTime LastDate = FristDate.AddMonths(1).AddDays(-1);
            return _dao.NghiepVu.GetDsPhienTiepNhanBHSC(FristDate, LastDate);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsPhienTiepNhanBHSCBetween(DateTime inNhanFromDate, DateTime inNhanToDate)
        {
            return _dao.NghiepVu.GetDsPhienTiepNhanBHSC(inNhanFromDate, inNhanToDate);
        }

        
        //////////////////////////////
        public IEnumerable<View_TheoDoiTraHang> GetDsPhienKhongDungHanInDay(DateTime inDay)
        {
            return _dao.NghiepVu.GetDsPhienKhongDungHan(inDay, inDay);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsPhienKhongDungHanInMonth(DateTime inMonth)
        {
            DateTime FristDate = new DateTime(inMonth.Year, inMonth.Month, 1);
            DateTime LastDate = FristDate.AddMonths(1).AddDays(-1);
            return _dao.NghiepVu.GetDsPhienKhongDungHan(FristDate, LastDate);
        }

        public IEnumerable<View_TheoDoiTraHang> GetDsPhienKhongDungHanBetween(DateTime inNhanFromDate, DateTime inNhanToDate)
        {
            return _dao.NghiepVu.GetDsPhienKhongDungHan(inNhanFromDate, inNhanToDate);
        }
        
    }
}
